/*
 * Copyright (c) 2025 Huawei Device Co., Ltd.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef OHOS_HMFS_RESIZE_LOAD_SIT_H
#define OHOS_HMFS_RESIZE_LOAD_SIT_H

#include <iostream>
#include "hmfs_data.h"
#include "hmfs_utils.h"
#include "resize_data.h"
#include "resize_utils.h"
#include "resize_load.h"

namespace OHOS {
namespace Hmfs {
class ResizeLoad;
class ResizeLoadSit{
public:
    ResizeLoadSit(ResizeLoad *loadPtr);
    ~ResizeLoadSit() = default;
	bool IsSyncDataRecord();
    int32_t BuildSitInfo();
    uint32_t GetStartSumBlock();
    uint32_t GetSumBlkAddr(int base, int type);
    void ReadCompactSummaries();
    void RestoreNodeSummary(unsigned int segno, struct SummaryBlockData *sumblk);
    void ReadNormalSummaries(int type);
    void UpdateCurSegSummaries();
    int32_t BuildCurSegment();
    int32_t BuildSegmentBegin();
    int32_t BuildSitEntries();
    void InsideSegInfoFromRawSit(struct SegEntry *se, struct sitEntry *rawSit);
    void SegInfoFromRawSit(struct SegEntry *se, struct sitEntry *rawSit);
    void CheckBlockCount(unsigned int segno, struct sitEntry *rawSit);
    int32_t LateBuildSegmentManager();
private:
    ResizeLoad *load_;
    std::shared_ptr<HmfsConfigData> config_; /** config */
    std::shared_ptr<HmfsSbInfo> sbInfo_; /** sbi */
};

// template<class T>
// class ResizeOperator : public Singleton<ResizeOperator<T>> {
// public:
//     T &GetResizeOperator();
// private:
//     T resizeOperator_;
// };

// template<class T>
// T &ResizeOperator<T>::GetResizeOperator()
// {
//     return resizeOperator_;
// }

}
}
#endif
